<script setup>
import { tagGetService } from '@/api/tag'
import { ref } from 'vue'
defineProps({
  modelValue: {
    type: [Number, String]
  },
  width: {
    type: String,
    default: '200px'
  }
})
const emit = defineEmits(['update:modelValue'])
//子组件通知父组件
const tagChannel = ref([])
const getTagChannel = async () => {
  const res = await tagGetService()
  tagChannel.value = res.data.data
}
getTagChannel()
</script>
<template>
  <el-select
    :modelValue="modelValue"
    @update:modelValue="emit('update:modelValue', $event)"
    :style="{ width }"
  >
    <!-- 子传父 -->
    <el-option
      v-for="tagChannel in tagChannel"
      :key="tagChannel.tagId"
      :label="tagChannel.tagName"
      :value="tagChannel.tagId"
    ></el-option>
  </el-select>
</template>
<style lang="scss" scoped></style>
